< previous page page_260 next page >

Page 260
EXERCISE
Set the SQL String for the RecordSource
1. Set the Command Text (SQL) property on the RecordSource tab in the ADO property page to SELECT * FROM tblEmployees.
analysis.gifSetting this property to an SQL string tells the Data Control where to get the information to build the Recordset object.

Setting the Text Boxes to Display Data
Now that youve set the data control to the appropriate data source and SQL statement. Its time to connect the fields in the table to the text boxes on your form. To connect the data in the table to the text boxes and check boxes, follow the steps shown in the next exercise.
EXERCISE
Hook Up the Data Control to Text Boxes
1. Click once on the First Name text box to give it focus.
2. Set the DataSource property to datEmployees. This is the name of the data control.
3. Click the DataField property to give it focus.
4. Click the drop-down arrow next to the property to display a drop-down list of field names.
5. Select the sFirst_nm field from the list.
6. Repeat these steps for each of the text boxes and the check boxes on the form. Just skip any of the other controls for now.
analysis.gifWhen youre finished, you should be able to run the project and see the data from the employee table. You can click the record movement buttons on the data control to move from one record to another.

Editing Records
Youre able to edit any of the data in the text boxes simply by typing into those text boxes. To save the changes you make, click any of the record movement buttons to move to another record. This saves any of the changed data in the text boxes back to the table.

 
< previous page page_260 next page >

If you like this book, buy it!